insert into #ZZMD0A
select	a13.ShiptoSearchTypeCode  ShiptoSearchTypeCode,
	a11.OrderNumber  OrderNumber,
	a11.LineNumber  LineNumber,
	a11.ShiptoNumber  AddressNumber,
	sum(a11.QuantityShipped)  WJXBFS1,
	sum(a11.ExtendedPrice)  WJXBFS2
from	MicroStrategy_Views.dbo.Sales_Star_Facts	a11
	join	MicroStrategy_Views.dbo.Common_Star_Dates	a12
	  on 	(a11.GLDateID = a12.CompanyDateID)
	join	MicroStrategy_Views.dbo.Sales_Star_Customer	a13
	  on 	(a11.CustomerNumberID = a13.CustomerNumberID)
where	(((a11.ShiptoNumber)
 in	(select	ps21.AddressNumber
	from	#ZZMQ00	ps21
		join	MicroStrategy_Views.dbo.Sales_Star_Customer	s23
		  on 	(ps21.AddressNumber = s23.ShiptoNumber)
	where	s23.Category05Code in ('O08')))
 and a11.TransactionType in (2)
 and a12.FiscalYear in (select distinct(FiscalYear) -1 from MicroStrategy_Views.dbo.Common_Star_Dates where Dates = '2012-04-06')
 and a12.FiscalMonth between '01' and (select distinct(FiscalMonth) from MicroStrategy_Views.dbo.Common_Star_Dates where Dates = '2012-04-06'))
group by	a13.ShiptoSearchTypeCode,
	a11.OrderNumber,
	a11.LineNumber,
	a11.ShiptoNumber OPTION (MERGE JOIN, LOOP JOIN)
	-- dsfs